package com.demo.domain;

/**
 * @author huangtao
 */
public class RealtimeEventEntity {

    private int userId;
    private int actionTimes;
    private long windowEnd;
    private String rankName;
    private int appActive = 0;
    private int miniProgramActive = 0;

    public static RealtimeEventEntity of(Integer itemId, String activeType, long end, Long count) {
        RealtimeEventEntity res = new RealtimeEventEntity();
        res.setActionTimes(count.intValue());
        res.setUserId(itemId);
        res.setWindowEnd(end);
        res.setRankName(String.valueOf(end));
        switch (activeType) {
            case "app":
                res.setAppActive(1);
                break;
            case "mini":
                res.setMiniProgramActive(1);
                break;
            default:
                break;
        }

        System.out.println("RealtimeEventEntity:" + res);
        return res;
    }

    public String getRankName() {
        return rankName;
    }

    public long getWindowEnd() {
        return windowEnd;
    }

    public void setWindowEnd(long windowEnd) {
        this.windowEnd = windowEnd;
    }

    public void setRankName(String rankName) {
        this.rankName = rankName;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getActionTimes() {
        return actionTimes;
    }

    public void setActionTimes(int actionTimes) {
        this.actionTimes = actionTimes;
    }

    public int getAppActive() {
        return appActive;
    }

    public void setAppActive(int appActive) {
        this.appActive = appActive;
    }

    public int getMiniProgramActive() {
        return miniProgramActive;
    }

    public void setMiniProgramActive(int miniProgramActive) {
        this.miniProgramActive = miniProgramActive;
    }

    @Override
    public String toString() {
        return "RealtimeEventEntity{" +
                "userId=" + userId +
                ", appActive=" + appActive +
                ", miniProgramActive=" + miniProgramActive +
                ", actionTimes=" + actionTimes +
                ", windowEnd=" + windowEnd +
                ", rankName='" + rankName + '\'' +
                '}';
    }

}
